<?php

class Engine_Mail extends Zend_Mail {

	public function __construct() {
		parent::__construct();
		
		$coreConfig = Zend_Registry::get('Core_Config');
		if ($coreConfig['smtp_enabled']) {
			if ($coreConfig['smtp_auth'] == 'login') {
				if ($coreConfig['smtp_ssl']) {
					$config['ssl'] = $coreConfig['smtp_ssl'];
				}
				$config['auth'] 	= $coreConfig['smtp_auth'];
				$config['port'] 	= $coreConfig['smtp_port'];
				$config['username'] = $coreConfig['smtp_username'];
				$config['password'] = $coreConfig['smtp_password'];
			}				
			$transport = new Zend_Mail_Transport_Smtp($coreConfig['smtp_server'], $config);
		} else {
			$transport = new Zend_Mail_Transport_Sendmail();
		}
		
		$this->setDefaultTransport($transport);
		return $this;
	}
	
}

?>